Repository navigation
Packs, connectors that are grains, and three blessed wasm tools (#178, #185, #179) - #226
Merged
Merged
Conversation
Three shared blobs ship in the repository with documented content addresses, plus `mailbox.poll`, the example connector #185 is demonstrated with. The point is not convenience. A tool gateway that decides *where a request may go* is code everyone installing it has to trust, and re-audit every time it changes. `http.call` makes no such decision: it hands the request to the broker and hands the answer back, verbatim, in both directions. Where it may go, which method, which credential and which headers are the Definition's `capabilities` and the host's grant -- data, in the memory, replicated with the tool, auditable without reading any code. The gateway becomes configuration. Two Definitions may name the same blob with different declarations, which is the shape a fleet wants: one address to pin, one blob to review, a per-service policy the memory states out loud. `mcp.call` and `a2a.call` add one JSON-RPC envelope and one unwrap over that, copying the caller's `arguments` BYTE FOR BYTE rather than round-tripping it -- a server that cares about key order sees what the caller wrote. They are separate blobs rather than one with a mode flag because a pack pins an address and declares a capability per tool: an MCP server and an agent-to-agent endpoint are different hosts with different credentials, and one blob doing both would be one address to grant for both. `no_std`, no dependencies, `http.call` is 2,598 bytes -- a blessed blob is reviewed as bytes, so what it carries is part of its security story. `serde_json` would pull an ecosystem into a module whose job is to move four strings into a different shape. What replaces it is a JSON *slicer*, not a parser. `areev-tools/` is a standalone workspace for the reason `areev-sandbox` and `areev-js` are, and one more: its crates are cdylibs for `wasm32-unknown-unknown`, so `cargo test --workspace` has no host to run them on. An import appears in a built blob only when it is CALLED, which is load-bearing rather than incidental -- the sandbox refuses an unlinked import by name before one instruction -- so `manifest.py` asserts each blob's import set against what its declaration admits, and fails the build rather than shipping a blob that would be refused at instantiation. Tested where the engine is: `areev-sandbox/tests/blessed_tools.rs` runs the COMMITTED bytes under real wasmi against a loopback broker stand-in, asserting the request each one builds, the answer each one returns, that every published address is the address of the file beside it, and that the import gate holds in both directions. Claude-Session: https://claude.ai/code/session_016YzyEfdWprezzATrZGNtg8 Signed-off-by: Sathish Kumar Palanisamy <sathish@mindgryd.com>
A polling connector was a host command (`--connector-cmd`), which put the code most likely to be wrong -- cursors, pagination, a provider's quirks -- outside the memory: it did not travel in a bundle, `areev tool provenance` could not chase it, and the loop could not propose a `code_revision` against it. Those are exactly the failures a gated code revision against recorded fixtures is built to fix, and they were invisible to a loop that could not see the code. A Trigger now carries `connector_tool`: a reference to a Tool DEFINITION whose `executor_uri` is the blob. A Definition and not a `cas://` address directly, because a blob is bytes -- the runtime, the limits, and above all the `capabilities` declaration that decides where the code may reach are Tool fields, and a second place to write them would be a second place for them to disagree. The evaluator reads it through the SAME `pin_from_definition` that `RunManifest::resolve` uses, and dispatches through the same `CodeExecutor`, so the sandbox argv, the capability registration, the per-call broker handshake and the cleared environment are one implementation rather than a second one that drifts -- and the one that would drift is this one, because nobody is watching a heartbeat. The authorization deliberately does not travel with the code. `--allow-executor` on the evaluating host is what runs it; without it the poll refuses with the new `TRG-E012` naming the address to pin, before a broker is started and before anything is spent. The same code covers a Definition carrying no `executor_uri`, a declared runtime with no `--sandbox-cmd`, and a blob-reading module on an evaluator wired no memory locator. A host that pinned nothing does NOT fall through to `--connector-cmd`: a fallback would run a different program than the declaration names, which is the failure with no symptom the pin exists to refuse. `connector` (the name) stays required beside it. The run id is derived from `(trigger, connector, dedup value)`, so revising the code must not renumber the runs. One fix falls out of the same path: the per-poll broker granted its connector only the DEFAULT token, which maps to no caller, so a grain connector's own capability declaration was invisible to the check that reads it and every blob read was refused as undeclared. It now also holds a grant under its own name. Both bindings take the pin on `trigger_run`/`trigger_deliver` off the existing `ExecutorPin`, so a host grants an address once and it means one thing. `trigger show` prints the connector and says when it is a grain. The spec-level record for the field is `docs/oms-1.7-amendments-connector-tool.md`. Breaking for direct constructors: `areev_trigger::Evaluator` gained a `connector_code` field. Claude-Session: https://claude.ai/code/session_016YzyEfdWprezzATrZGNtg8 Signed-off-by: Sathish Kumar Palanisamy <sathish@mindgryd.com>
A pack is an installable agent: a manifest, the grains it seeds, and the code blobs those grains name. It replaces the installer everyone deploying an agent was otherwise writing -- blobs into the CAS, each `executor_uri` rewritten to the address the bytes turned out to have, grains seeded in dependency order, plan hashes checked -- with one verb, so self-hosters get the same door a managed deployment does. Three properties make it more than a script. References are SYMBOLIC (`blob:<name>`, `grain:<id>`). An address is a measurement of bytes, not something an author can write down: install stores the blob, learns its address, rewrites the Definition, addresses *that*, and rewrites the plan that binds it. Grains are addressed in manifest order and a forward reference is refused rather than guessed at, which is why `grains` is an ordered list and not a set. It also means editing a connector's wasm changes the plan's hash -- the property that makes the next one worth having. `expected_hash` is REFUSED, not warned, with nothing written. A plan installed at a different address than the deployment expects has changed what runs, and everything pointing at the old hash -- triggers above all, which do not follow heads -- is now pointing elsewhere. Install is validate plus a destination. Every grain is built and addressed with NO store at all, since content addressing is a pure function of the serialized grain, so `pack validate` opens no memory, creates no file, and can run in CI on a pull request; a refused pack leaves the memory exactly as it found it (half an agent is worse than none). Export writes either reviewable grain JSON, refusing to write anything it cannot rebuild to the same address, or a bundle plus a manifest of what it must contain. Saved queries and templates travel too, or an installed agent loses the context assembly its triggers name. The pins it prints are exactly the addresses some Definition names as its `executor_uri` -- never the data blobs a pack also carries, since asking an operator to authorize data as executable is asking for the wrong permission. Every agent under `examples/agents/` now ships a `pack/`, EXPORTED from its own freshly seeded memory rather than written by hand, because the grains a pack installs and the grains a seeder writes have to be the same grains and the only way to keep them the same is to derive one from the other. `run-smokes.sh` gained a `pack` lane asserting each installs the plan its language stacks mint. That lane immediately earned itself: `sanctions-screening` stamped its evalset Fact -- the gate Rule E1 pins on the `screen` tool -- with the wall clock, so the tool's hash and therefore the desk's plan hash differed on every seed. Nothing had caught it because the cross-stack comparison needs two stacks and that desk has one. The seeder now pins `created_at` like every other grain it writes, and the desk records a wider `cold_grains` window beside its existing `run_outcome` tuning: its evalset is reference data read by the gate at review time, so "never recalled in 30 days" measures the wrong thing for it -- and retiring an evalset would remove the gate a code revision has to pass. Two hand-written packs land as examples, both keyless and offline and both in CI. `examples/grain-connector/` is #185's acceptance: a polling trigger whose connector is a pinned wasm blob, with no host connector script anywhere, and the `TRG-E012` refusal a host that pinned nothing gets. `examples/blessed-tools/` is #179's: a pack binding the shipped `http.call` blob with declared hosts, one permitted call (200 -- and the stub 401s anything without the exact bearer token, so that is the proof the broker attached a credential the tool never held), one call to an undeclared host refused by the broker with `RUN-E022`, and `areev tool provenance` chaining the blob. Claude-Session: https://claude.ai/code/session_016YzyEfdWprezzATrZGNtg8 Signed-off-by: Sathish Kumar Palanisamy <sathish@mindgryd.com>
sathish-mg
force-pushed
the
feat/packs-grain-connectors-blessed-tools
branch
from
September 10, 2026 09:26
5b21b4d to
f4ff575
Compare
Two bugs the work in this branch surfaced, both in the same place: a piece of governed code and the things that point at it. **`areev tool provenance` reported no runs for a tool a run had just executed.** `docs/run.md` said the command chains code "to the runs that executed it", and it answered `runs_touching: 0`. The walk behind it is a PROVENANCE walk — `derived_from` up, the reverse index down — and there is no provenance edge to find: a journal's result grain supersedes its intent, and neither supersedes the Definition. What connects a run to the code it ran is §8.4's `spec_hash`, which the intent carries and nothing reads backwards. `runs_touching` now also follows that edge for a Tool Definition (`Areev::runs_executing`, useful on its own). It is a bounded scan rather than an index read because `spec_hash` is a field and not a `related_to` link — affordable for the same reason the runtime's definition-catalogue scan is, and skipped entirely unless the target IS a Definition, so no other caller pays for it. A conformance case pins it on both backends, since a scan is exactly the kind of read that can differ when one backend's `recent` windows differently from the other's. `examples/blessed-tools/` now asserts both runs — the refused one included, because a request the broker turned down is still a run that touched that code. **`cold_grains` proposed retiring a Rule E1 gate.** An evalset a live Tool Definition pins is read by the gate at review time, never through recall, so it aged past the grace window and came back as a retire candidate — naming the one grain that must not be retired, since removing it removes the gate a `code_revision` has to pass. Recall counts measure whether a fact informs *answers*; that fact's job is to judge *code*, so the analyzer was answering a question nobody asked about it. Facts pinned as `evalset_hash` by a live Definition are now excluded, and deliberately only those. A general "any hash a live grain mentions" sweep would also swallow the evidence a pending recommendation cites — and since this analyzer's own findings cite the fact they flag, every cold finding would suppress itself on the next run. `examples/agents/sanctions-screening` drops the config widening it needed to work around this and asserts the clean result instead, which is what makes the fix provable end to end rather than only in a unit test. Claude-Session: https://claude.ai/code/session_016YzyEfdWprezzATrZGNtg8 Signed-off-by: Sathish Kumar Palanisamy <sathish@mindgryd.com>
Five conflicts, all of them two features landing beside each other rather than disagreeing: - `areev-run/src/lib.rs` — `pin_from_definition` (#185) and `subgraph_run_id` (#187) are separate re-exports; both kept. - both bindings — the trigger evaluator now builds a connector's code config (#185) AND an egress handle for the runs a firing starts (#201). Both lines belong, in that order. Main had independently added the same `path` field for the broker's blob door (#106), which is the same locator this branch wanted for a grain connector's `areev::blob_get`: one field, one doc naming both readers, rather than two fields with one name. - `docs/run.md` — the binding spelling of a capability-tool run (#201) and the note that a trigger's connector is one of those too (#185). The first extends the snippet above it, so it goes first. - `CHANGELOG.md` — separate entries in one list, main's ahead. Claude-Session: https://claude.ai/code/session_016YzyEfdWprezzATrZGNtg8 Signed-off-by: Sathish Kumar Palanisamy <sathish@mindgryd.com>
Generated artifacts only: `scripts/repo_stats.py` over the merge. The coverage input is unchanged — CI's `coverage` job measures the merged tree and its own check is what would fail if the committed figure had drifted. Claude-Session: https://claude.ai/code/session_016YzyEfdWprezzATrZGNtg8 Signed-off-by: Sathish Kumar Palanisamy <sathish@mindgryd.com>
Generated artifacts. The previous figure (81.8%) was measured before this branch merged main, so it described neither tree — inside the gate's tolerance, but a committed measurement should be a measurement of something. Every crate is at or above its floor; `areev-mcp`, the tightest at 71.4% against a 71.0 floor, now measures 78.8% on main's own work. Claude-Session: https://claude.ai/code/session_016YzyEfdWprezzATrZGNtg8 Signed-off-by: Sathish Kumar Palanisamy <sathish@mindgryd.com>
Both were mine, and both are the same shape of mistake — something that works on the machine it was written on and cannot work on the machine CI runs. `trigger_smoke`'s last step executed a pinned NATIVE blob, and the pack it installs carries a `#!/bin/sh` one. Windows answered "%1 is not a valid Win32 application", which is correct: a native blob IS a program, so it is platform-specific by construction and `docs/run.md` says to pin per platform. The step is now `#[cfg(unix)]`. What stays cross-platform is the part that must hold everywhere — the flag reaches the declaration, and an unpinned or wrongly-pinned host refuses — and `grain_connector_tests` already gates its own "and then it ran" the same way. `examples/blessed-tools/run.sh` waited for its stub upstream with bash's `/dev/tcp`, in a `#!/bin/sh` script. On macOS `/bin/sh` is bash and the probe works; on Ubuntu it is dash, which has no such device, so the probe could never succeed and the example failed after its ten-second budget. It now probes with python3, which the example already requires because the stub is python3. Both examples were re-run under dash — the shell CI actually uses — rather than reasoned about. Claude-Session: https://claude.ai/code/session_016YzyEfdWprezzATrZGNtg8 Signed-off-by: Sathish Kumar Palanisamy <sathish@mindgryd.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #185, closes #178, closes #179.
Three issues that only make sense together: the code an agent runs, how it is
installed, and what nobody should have to write from scratch.
#185 — a trigger can name its connector by content address
A polling connector was a host command, which put the code most likely to be
wrong — cursors, pagination, a provider's quirks — outside the memory: no
bundle carried it,
tool provenancecould not chase it, and the loop could notpropose a
code_revisionagainst it.A Trigger now carries
connector_tool, a reference to a Tool Definition(not a
cas://address directly — the runtime, limits andcapabilitiesthatdecide where the code may reach are Tool fields, and a second place to write
them is a second place for them to disagree). The evaluator reads it through
the same
pin_from_definitionRunManifest::resolveuses and dispatchesthrough the same
CodeExecutor, so there is one implementation of the pin, theruntime table and the capability check rather than a second one that drifts on
the surface nobody watches.
The authorization does not travel with the code:
--allow-executoron theevaluating host runs it, and without it the poll refuses with the new
TRG-E012naming the address to pin, before a broker starts. A host thatpinned nothing does not fall through to
--connector-cmd— that would run adifferent program than the declaration names.
One fix fell out of the same path: the per-poll broker granted the connector
only the default token, which maps to no caller, so a grain connector's own
capability declaration was invisible to the check that reads it and every blob
read was refused as undeclared.
#178 —
areev pack validate | install | exportReferences are symbolic (
blob:<name>,grain:<id>) because an address isa measurement of bytes; install stores the blob, learns its address, rewrites
the Definition, addresses that, then rewrites the plan binding it.
expected_hashis refused, not warned, with nothing written. Grains arebuilt and addressed with no store at all, so
validategenuinely speaks forinstall.All ten agent examples ship a
pack/exported from their own freshly seededmemory, and
run-smokes.shgained apacklane asserting each installs theplan its language stacks mint. That lane immediately caught a latent bug:
sanctions-screeningstamped its Rule E1 evalset with the wall clock, so thedesk's plan hash differed on every seed — invisible until now because the
cross-stack comparison needs two stacks and that desk has one.
#179 — blessed
wasm32-areev-iotoolshttp.call(2,598 bytes),mcp.call,a2a.callship as committed blobswith published addresses.
http.callmakes no policy decision at all — ithands the request to the broker and the answer back, verbatim both ways — so
the Definition's
capabilitiesand the host's grant are the whole policy: datain the memory, auditable without reading any code. Two Definitions may name the
same blob with different declarations, which is the shape a fleet wants.
no_std, zero dependencies, a JSON slicer rather than a parser (a caller'sargumentsobject travels byte for byte).areev-sandbox/tests/blessed_tools.rsruns the committed bytes under real wasmi against a loopback broker
stand-in, including that the import gate holds in both directions.
Acceptance, and where each clause is proven
wasm32-areev-ioconnector by content addressexamples/grain-connector/pack/grains/040-trigger.json;crates/areev-trigger/tests/grain_connector_tests.rsexamples/grain-connector/run.sh(keyless, offline, in CI)pack install, smokes passpack/dirs + thepacklane;REQUIRE="… pack"in CIexpected_hashis refusedpack_smoke.rs::a_mismatched_expected_hash_is_refused_with_nothing_writtenpack exportround-trips into a fresh memorypack_smoke.rs, both source and bundle formatshttp.callwith declared hostsexamples/blessed-tools/pack/examples/blessed-tools/run.shstep 3 —RUN-E022, journaledareev tool provenancechains the blobVerification
cargo test --workspace— 2,123 tests, green (run undercargo llvm-cov)cargo clippy --workspace --all-targets -- -D warnings— clean; same forareev-sandboxandareev-toolsrepo_stats.py --check,check_versions.py,areev-tools/manifest.py --check— passTwo bugs this work surfaced, fixed here
Both are about a piece of governed code and the things that point at it, and
both were found by building the examples above rather than by reading the code.
areev tool provenancereported no runs for a tool a run had justexecuted.
docs/run.mdsaid it chains code "to the runs that executed it";it answered
runs_touching: 0. The walk behind it is a provenance walk, andthere is no provenance edge to find — a journal's result grain supersedes its
intent, and neither supersedes the Definition. What connects a run to the code
it ran is §8.4's
spec_hash, which nothing read backwards.runs_touchingnowfollows it for a Tool Definition (
Areev::runs_executing), as a bounded scanskipped entirely unless the target IS a Definition, pinned by a conformance
case on both backends. Affected
--tool-cmdtools identically.cold_grainsproposed retiring a Rule E1 gate. An evalset a liveDefinition pins is read by the gate at review time, never through recall, so it
aged past the grace window and came back as a retire candidate — naming the one
grain that must not be retired, since removing it removes the gate a
code_revisionhas to pass. Facts pinned asevalset_hashby a liveDefinition are now excluded, and deliberately only those: a general "any hash a
live grain mentions" sweep would swallow the evidence a pending recommendation
cites, and since this analyzer's own findings cite the fact they flag, every
cold finding would suppress itself on the next run.
examples/agents/sanctions-screeningdrops the config widening it had neededto work around the second one and asserts the clean result instead, and
examples/blessed-tools/asserts both runs for the first — the refused oneincluded, because a request the broker turned down is still a run that touched
that code.
https://claude.ai/code/session_016YzyEfdWprezzATrZGNtg8